/*Program to create graphs showing commitment index with other variables
Programmed by Felipe Schwartzman, 

modified by Scott Fulford 7-19-2015
modified by Scott Fulford 1-24-2018 to run in new directory
modified by Scott Fulford 4-26-2018 to also show articles index
*/
clear

set scheme s1color

//Change rootdir to where store files
	global ROOTDIR "F:/Dropbox/national banks peg/Replication_files"

global OUTDIR "$ROOTDIR/data"

/*** Silver dates from Weiss 2018
Dates when news of silver was particularly important. When there is a date range, take last day
*/

input str20 datetext str100 description str3 direction_text
"March 4, 1884" "Juilliard v. Greenman Legal Tender Case Decision" "(+)"
"February 27, 1885" "Repeal of Bland-Allison Voted Down" "(+)"
"December 9, 1885" "Pres. Cleveland calls for repeal of Bland-Allison in 1st message to Congress" "(-)"
"December 22, 1885" "Senator Beck delivers speech shooting down B-A repeal" "(+)"
"June 9, 1890" "Compromise silver purchase measure passes House" "(-)"
"June 18, 1890" "Senate passes free silver measure" "(+)"
"July 8, 1890" "New silver bill agreed upon by Republican conferrees of House and Senate" "(+)"
"January 15, 1891" "Free sliver bill passes Senate" "(+)"
"February 20, 1891" "House Coinage committee votes against Senate silver bill" "(-)"
"July 5, 1892" "Free silver bill passes Senate" "(+)"
"July 14, 1892" "Free silver rejected in House" "(-)"
"December 7, 1892" "Introduction of Sherman Act repeal" "(-)"
"February 10, 1893" "House refuses to consider act repealing Sherman Act" "(+)"
"July 1, 1893" "Pres. Cleveland orders emergency session of Congress to repeal Sherman Act in August" "(-)"
"August 29, 1893" "House repeals Sherman Act by 2-1 majority" "(-)"
"September 28, 1893" "Pres. Cleveland writes letter stating he will only accept unconditional repeal of Sherman Act" "(-)"
"October 24, 1893" "Compromise repeal fails to pass Senate" "(-)"
"June 16, 1896" "Republicans announce campaign platform for gold standard" "(-)"
"July 1, 1896" "Free silver Democrats to control presidential nomination" "(+)"
"August 13, 1896" "William Jennings Bryan speech on Wall St disappoints" "(-)"
"November 4, 1896" "Election of Republican candidate William McKinley" "(-)"
end
gen  date=date(datetext, "MDY")
format date %td
//Reverse direction so it is Pro-Gold
gen direction = -1 if direction_text == "(+)"
replace direction = 1 if direction_text == "(-)"
gen year=year(date)
gen month = month(date)
collapse (sum) direction, by(year month)

tempfile Weissdates
save `Weissdates', replace

/****** 
Load New York Times mentions of "free coinage" 
Data created by Scott from New York Times archive
****/

import delimited datetext using "$ROOTDIR/data/New York Times free coinage dates.txt", delimiter(tab) clear
gen date=date(datetext, "#MDY")
format date %td
gen year=year(date)
gen month = month(date)
gen articles =1
collapse (count) articles, by(year month)
//Normalize 14995 articles in New York Times archive in 1896
//replace articles = articles/(14995/12)

tempfile articles
gen date = ym(year,month)
format date %tm

save `articles', replace

/*** Create top specie/asset and bottom specie/asset to compare to index ***/
//Create before 1890 specie/asset ratio
use "$OUTDIR/National_bank_call_reports_states", clear
 tsset  loc_no call_date_order
gen r_specie_assets = specie_assets/total_assets
egen lntemp = mean(ln(r_specie_assets)) if call_year<1890, by(loc_no)
egen lnbr_specie_assets = mean(lntemp), by(loc_no) //Before 1890 average of log
drop lntemp

gen leverage = (total_assets-(capital_stock_liab+ surplus_fund_liab+ undivided_profits_liab+ dividends_unpaid_liab)) /total_assets

gen Dleverage = (leverage)-(l.leverage) // differences

sort call_date lnbr_specie_assets
by call_date: gen specie_order = _n
//Do in 1910 because that has the largest number, try to have a consistent number in top and bottom 10
gen temp_bot_specie = (specie_order <=10) if call_year ==1910
gen temp_top_specie = (specie_order >=41) if call_year ==1910
sort loc_no call_date
by loc_no: egen top_specie = max(temp_top_specie)
by loc_no: egen bot_specie = max(temp_bot_specie)
sort call_date loc_no
gen temp_top_Dlev =Dleverage if top_specie
gen temp_bot_Dlev =Dleverage if bot_specie
collapse mean_Dlev_top_specie = temp_top_Dlev mean_Dlev_bot_specie = temp_bot_Dlev, by(call_date)
gen diff_Dlev_specie = mean_Dlev_top_specie-mean_Dlev_bot_specie
label var diff_Dlev_specie "Difference in change in leverage between top 10 and bottom 10 specie/asset states"
tempfile topbottom10
save `topbottom10', replace

//use "$ROOTDIR`slash'national banks peg`slash'data`slash'National_bank_call_reports_aggregate", clear

use "$OUTDIR/National_bank_call_reports_aggregate", clear


/*Merge with and display treasury gold*/
gen month = month(call_date)
gen year = year(call_date)
order month year
sort year month

//Load credibility index data created by Felipe
//merge 1:1 year month using "$ROOTDIR`slash'national banks peg`slash'data`slash'FS.dta"
merge 1:1 year month using "$ROOTDIR/data/FS.dta"



drop _merge
tsset date
replace total_assets = total_assets - bonds_circulation_assets





gen ln_leverage = log((total_assets-(capital_stock_liab+ surplus_fund_liab+ undivided_profits_liab+ dividends_unpaid_liab)) /(capital_stock_liab+ surplus_fund_liab+ undivided_profits_liab+ dividends_unpaid_liab))
label var ln_leverage "Log National Bank Leverage" //Debt/Equity

gen leverage = (total_assets-(capital_stock_liab+ surplus_fund_liab+ undivided_profits_liab+ dividends_unpaid_liab)) /total_assets
label var leverage "National Bank Leverage" //Debt/assets

//label variable spread "Expected Dollar Appreciation"
//label variable spread "R(B)-R(G)"

label variable spread "60 day gold premium (negative)"

//Create yearly difference. Call dates are five times a year and so do not align nicely
//with other variables. Note that using sort, not tsset
capture gen d5ln_leverage = ln_leverage-ln_leverage[_n-5]
capture gen d5F1 = F1-F1[_n-5]
capture gen d5spread = spread-spread[_n-5]
capture gen d1F1 = F1-F1[_n-1]



label var F1 "Credibility index"
local F1title "Credibility index"

twoway (rarea F1_l F1_u date, color(gs15)) (tsline F1) , ///
  tline(1890m7 1893m7 1896m12 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) ///
  ttext(-1 1907m5 "1907" "Panic", just(right) placement(w) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
  tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
   legend(off) name(fig1, replace) 
  graph export cred_index.pdf, as(pdf) font(times) name(fig1) replace




//Change directory to where save output figures
cd "$OUTDIR"

//Merge top bottom specie index
merge 1:1 call_date using `topbottom10'
drop if _merge ==2 //Only in created from averages
drop _merge


//Merge articles index
merge 1:1 year month using `articles'
drop _merge
label var articles "New York Times articles discussing free coinage"

merge 1:1 year month using `Weissdates'
drop _merge
label var direction "Direction of Silver News from Weiss (2018)"


//Time set
tsset date
sort date
capture gen d5articles = articles-l12.articles


local scalingfactor 45
local fontscale .8

/*** Graph for articles in news ***/
correl F1 articles
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5articles
local corrdisp_1d: display %4.3f r(rho)


//Create a correlation with Weiss news
//Need to create the sum of events since last
//call date
gsort - date
gen calldateN = 1 if call_date <.
gen calldatecount = sum(calldateN)
sort calldatecount
by calldatecount: egen sumdirection = total(direction), missing
replace sumdirection =. if call_date >=.
sort date

//How does the change between call dates relate to sum of news during 
//call dates? 
reg d1F1 sumdirection
correl d1F1 sumdirection

local placement =-7.5
gen placement = `placement'
gen arrow = (direction)/2 +placement

twoway (rarea F1_l F1_u date, color(gs13)) ///
 (tsline articles, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)) ///
 (pcarrow  placement date arrow date if direction >0, mcolor(green)) ///
 (pcarrow  placement date arrow date if direction <0, mcolor(red)) ///
 (scatter  arrow date if direction ==0, msymbol(circle_hollow) mcolor(blue) )  ,  ///
  tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(1.6 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.1 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.1 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(1.6 1893m5 "1893" "Panic", just(right) placement(w) size(small)) /// 
  ttext(1.6 1896m11 "1896" "Election", just(right) placement(w) size(small)) ///
  ttext(`placement' 1897m6 "Pro-Gold Policy News (Weiss, 2017)" "Pro-Silver Policy News", just(left) placement(e) size(small)) ///
  legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  yscale(axis(2) range(-30 250)) ///
  ttext(-5 1907m4 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
  name(news_out, replace) subtitle(Credibility Index and Silver News)
  graph export cred_index_articles.pdf, as(pdf) font(times) name(news_out) replace



twoway (rarea F1_l F1_u date, color(gs13)) ///
 (tsline articles, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)) ///
 (pcarrow  placement date arrow date if direction >0, mcolor(green)) ///
 (pcarrow  placement date arrow date if direction <0, mcolor(red)) ///
 (scatter  arrow date if direction ==0, msymbol(circle_hollow) mcolor(blue) )  ,  ///
  tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(1.6 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.1 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.1 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(1.6 1893m5 "1893" "Panic", just(right) placement(w) size(small)) /// 
  ttext(1.6 1896m11 "1896" "Election", just(right) placement(w) size(small)) ///
  ttext(`placement' 1897m6 "Pro-Gold Policy News (Weiss, 2017)" "Pro-Silver Policy News", just(left) placement(e) size(small)) ///
  legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  yscale(axis(2) range(-30 250)) ///
  ttext(-4.5 1907m8 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
  name(news, replace) fysize(`scalingfactor') scale(`fontscale')  subtitle(Credibility Index and Silver News)

/*** Graph for Gold premium and credibility ***/
  
correl F1 spread if year <1900
correl F1 spread if year >=1900

correl F1 spread
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5spread
local corrdisp_1d: display %4.3f r(rho)

twoway (rarea F1_l F1_u date, color(gs13))  (tsline spread, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
  tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m4 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
  name(fig2_out, replace) subtitle(Credibility Index and the Gold Premium)
  graph export cred_index_gold_premium.pdf, as(pdf) font(times) name(fig2_out) replace


twoway (rarea F1_l F1_u date, color(gs13))  (tsline spread, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m8 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
    name(fig2, replace) fysize(`scalingfactor') scale(`fontscale') subtitle(Credibility Index and the Gold Premium)
   
/*
  twoway (tsline F1_l, lpattern(-) lcolor(navy)) (tsline F1) (tsline F1_u, lpattern(-) lcolor(navy)) , ///
  tline(1890m7 1893m7 1896m12 1907m12, lcolor(navy)) ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
  ytitle("Relative Return Index") ttext(-3 1907m5 "1907" "Panic", just(right) placement(w) size(small)) legend(off) ///
  ttext(-5 1906m1 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) name(fig2, replace)
*/
  
  label variable netgoldintreasury "Net Gold in Treasury (millions $)"

  capture gen d5netgoldintreasury = netgoldintreasury-l5.netgoldintreasury


correl F1 netgoldintreasury
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5netgoldintreasury
local corrdisp_1d: display %4.3f r(rho)

twoway (rarea F1_l F1_u date, color(gs13))  (tsline netgoldintreasury, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m4 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
    name(fig3_out, replace) subtitle(Credibility Index and Treasury Gold)

  graph export cred_index_treasury_gold.pdf, as(pdf) font(times) name(fig3_out) replace

  
twoway (rarea F1_l F1_u date, color(gs13))  (tsline netgoldintreasury, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m8 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
  name(fig3, replace) fysize(`scalingfactor') scale(`fontscale') subtitle(Credibility Index and Treasury Gold)



correl F1 ln_leverage
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5ln_leverage
local corrdisp_1d: display %4.3f r(rho)
  
twoway (rarea F1_l F1_u date, color(gs13))  (tsline ln_leverage, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m4 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
  name(fig4, replace) subtitle(Credibility Index and Bank Leverage)
   graph export cred_index_bank_ln_leverage.pdf, as(pdf) font(times) name(fig4) replace


capture gen d5leverage = leverage-l5.leverage
  
correl F1 leverage
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5leverage
local corrdisp_1d: display %4.3f r(rho)
  
twoway (rarea F1_l F1_u date, color(gs13))  (tsline leverage, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ttext(-5 1907m8 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
    name(fig4, replace) fysize(`scalingfactor') scale(`fontscale')  subtitle(Credibility Index and Bank Leverage)
   graph export cred_index_bank_leverage.pdf, as(pdf) font(times) name(fig4) replace

 
  graph combine news fig3 fig2   fig4, imargin(small) cols(2) xcommon xsize(9) ysize(6) name(cred_index_treasury_spread, replace)
  

  graph export cred_index_treasury_spread.pdf, as(pdf) font(times) name(cred_index_treasury_spread) replace

  /*
twoway (tsline F1_l, lpattern(-) lcolor(navy)) (tsline F1) (tsline F1_u, lpattern(-) lcolor(navy)) (tsline netgoldintreasury, yaxis(2)), ///
  tline(1890m7 1893m7 1896m12 1907m12, lcolor(navy)) ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
  ytitle("Relative Return Index") ttext(-3 1907m5 "1907" "Panic", just(right) placement(w) size(small)) legend(off) ///
  ttext(-5 1906m1 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) name(fig3, replace)
*/

capture gen cumdiff_Dlev_specie = sum(diff_Dlev_specie)
capture gen d5cumdiff_Dlev_specie = cumdiff_Dlev_specie-l5.cumdiff_Dlev_specie

correl F1 cumdiff_Dlev_specie
local corrdisp_1: display %4.3f r(rho)

correl d5F1 d5cumdiff_Dlev_specie
local corrdisp_1d: display %4.3f r(rho)
  
twoway (rarea F1_l F1_u date, color(gs13))  (tsline cumdiff_Dlev_specie, lcolor(orange) yaxis(2)) (tsline F1, lcolor(navy) lwidth(medthick)),  ///
tline(1890m7 1893m7 1896m12 1900m3 1907m12, lcolor(gs10)) /// 
  ttext(.77 1890m5 "Sherman Silver" "Purchase Act", just(right) placement(w) size(small)) /// 
  ttext(-2.6 1900m6 "Gold" "Standard" "Act", just(left) placement(e) size(small)) ///
  ttext(-2.6 1908m3 "1907" "Panic", just(left) placement(e) size(small)) ///
  ttext(.77 1893m5 "1893" "Panic", just(right) placement(w) size(small)) ttext(.77 1896m11 "1896" "Election", just(right) placement(w) size(small)) legend(on) ///
   xtitle("") xlabel(none) /// 
   tlabel(1880m1(60)1910m1) tmtick(1880m1(12)1910m1) xtitle(Date) ///
  ytitle("`F1title'", axis(1)) legend(off) ///
  ytitle("Cumulative difference in leverage change between" "top and bottom pre-1890 specie states", axis(2)) ///
  ttext(-5 1907m8 "CORRELATIONS" "level:  `corrdisp_1'" "y-o-y: `corrdisp_1d'", just(left) placement(w) size(small)) /// 
    name(diff_Dlev_specie, replace) /*fysize(`scalingfactor') scale(`fontscale')  subtitle(Credibility Index and alternative index) */
   graph export cred_index_tobotspecie.pdf, as(pdf) font(times) name(diff_Dlev_specie) replace


exit
